home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 60 / IOPROG_60.ISO / soft / c++ / gsl-1.1.1-setup.exe / {app} / src / cblas / test_spr.c < prev    next >
Encoding:
C/C++ Source or Header  |  2002-04-18  |  3.7 KB  |  164 lines

  1. #include <gsl/gsl_test.h>
  2. #include <gsl/gsl_ieee_utils.h>
  3. #include <gsl/gsl_math.h>
  4. #include <gsl/gsl_cblas.h>
  5.  
  6. #include "tests.h"
  7.  
  8. void
  9. test_spr (void) {
  10. const double flteps = 1e-4, dbleps = 1e-6;
  11.   {
  12.    int order = 101;
  13.    int uplo = 121;
  14.    int N = 2;
  15.    float alpha = -0.3f;
  16.    float Ap[] = { -0.764f, -0.257f, -0.064f };
  17.    float X[] = { 0.455f, -0.285f };
  18.    int incX = -1;
  19.    float Ap_expected[] = { -0.788367f, -0.218097f, -0.126108f };
  20.    cblas_sspr(order, uplo, N, alpha, X, incX, Ap);
  21.    {
  22.      int i;
  23.      for (i = 0; i < 3; i++) {
  24.        gsl_test_rel(Ap[i], Ap_expected[i], flteps, "sspr(case 1426)");
  25.      }
  26.    };
  27.   };
  28.  
  29.  
  30.   {
  31.    int order = 101;
  32.    int uplo = 122;
  33.    int N = 2;
  34.    float alpha = -0.3f;
  35.    float Ap[] = { -0.764f, -0.257f, -0.064f };
  36.    float X[] = { 0.455f, -0.285f };
  37.    int incX = -1;
  38.    float Ap_expected[] = { -0.788367f, -0.218097f, -0.126108f };
  39.    cblas_sspr(order, uplo, N, alpha, X, incX, Ap);
  40.    {
  41.      int i;
  42.      for (i = 0; i < 3; i++) {
  43.        gsl_test_rel(Ap[i], Ap_expected[i], flteps, "sspr(case 1427)");
  44.      }
  45.    };
  46.   };
  47.  
  48.  
  49.   {
  50.    int order = 102;
  51.    int uplo = 121;
  52.    int N = 2;
  53.    float alpha = -0.3f;
  54.    float Ap[] = { -0.764f, -0.257f, -0.064f };
  55.    float X[] = { 0.455f, -0.285f };
  56.    int incX = -1;
  57.    float Ap_expected[] = { -0.788367f, -0.218097f, -0.126108f };
  58.    cblas_sspr(order, uplo, N, alpha, X, incX, Ap);
  59.    {
  60.      int i;
  61.      for (i = 0; i < 3; i++) {
  62.        gsl_test_rel(Ap[i], Ap_expected[i], flteps, "sspr(case 1428)");
  63.      }
  64.    };
  65.   };
  66.  
  67.  
  68.   {
  69.    int order = 102;
  70.    int uplo = 122;
  71.    int N = 2;
  72.    float alpha = -0.3f;
  73.    float Ap[] = { -0.764f, -0.257f, -0.064f };
  74.    float X[] = { 0.455f, -0.285f };
  75.    int incX = -1;
  76.    float Ap_expected[] = { -0.788367f, -0.218097f, -0.126108f };
  77.    cblas_sspr(order, uplo, N, alpha, X, incX, Ap);
  78.    {
  79.      int i;
  80.      for (i = 0; i < 3; i++) {
  81.        gsl_test_rel(Ap[i], Ap_expected[i], flteps, "sspr(case 1429)");
  82.      }
  83.    };
  84.   };
  85.  
  86.  
  87.   {
  88.    int order = 101;
  89.    int uplo = 121;
  90.    int N = 2;
  91.    double alpha = -1;
  92.    double Ap[] = { 0.819, 0.175, -0.809 };
  93.    double X[] = { -0.645, -0.222 };
  94.    int incX = -1;
  95.    double Ap_expected[] = { 0.769716, 0.03181, -1.225025 };
  96.    cblas_dspr(order, uplo, N, alpha, X, incX, Ap);
  97.    {
  98.      int i;
  99.      for (i = 0; i < 3; i++) {
  100.        gsl_test_rel(Ap[i], Ap_expected[i], dbleps, "dspr(case 1430)");
  101.      }
  102.    };
  103.   };
  104.  
  105.  
  106.   {
  107.    int order = 101;
  108.    int uplo = 122;
  109.    int N = 2;
  110.    double alpha = -1;
  111.    double Ap[] = { 0.819, 0.175, -0.809 };
  112.    double X[] = { -0.645, -0.222 };
  113.    int incX = -1;
  114.    double Ap_expected[] = { 0.769716, 0.03181, -1.225025 };
  115.    cblas_dspr(order, uplo, N, alpha, X, incX, Ap);
  116.    {
  117.      int i;
  118.      for (i = 0; i < 3; i++) {
  119.        gsl_test_rel(Ap[i], Ap_expected[i], dbleps, "dspr(case 1431)");
  120.      }
  121.    };
  122.   };
  123.  
  124.  
  125.   {
  126.    int order = 102;
  127.    int uplo = 121;
  128.    int N = 2;
  129.    double alpha = -1;
  130.    double Ap[] = { 0.819, 0.175, -0.809 };
  131.    double X[] = { -0.645, -0.222 };
  132.    int incX = -1;
  133.    double Ap_expected[] = { 0.769716, 0.03181, -1.225025 };
  134.    cblas_dspr(order, uplo, N, alpha, X, incX, Ap);
  135.    {
  136.      int i;
  137.      for (i = 0; i < 3; i++) {
  138.        gsl_test_rel(Ap[i], Ap_expected[i], dbleps, "dspr(case 1432)");
  139.      }
  140.    };
  141.   };
  142.  
  143.  
  144.   {
  145.    int order = 102;
  146.    int uplo = 122;
  147.    int N = 2;
  148.    double alpha = -1;
  149.    double Ap[] = { 0.819, 0.175, -0.809 };
  150.    double X[] = { -0.645, -0.222 };
  151.    int incX = -1;
  152.    double Ap_expected[] = { 0.769716, 0.03181, -1.225025 };
  153.    cblas_dspr(order, uplo, N, alpha, X, incX, Ap);
  154.    {
  155.      int i;
  156.      for (i = 0; i < 3; i++) {
  157.        gsl_test_rel(Ap[i], Ap_expected[i], dbleps, "dspr(case 1433)");
  158.      }
  159.    };
  160.   };
  161.  
  162.  
  163. }
  164.